/*
 * drawPrimitivesWindows.c
 *
 *  Created on: Jul 4, 2008
 *      Author: Carlos Oliveira
 */

#include "drawPrimitivesWindows.h"

GContext gContext_createWindowsContext()
{
	GContextWindows gc =
		(GContextWindows)malloc(sizeof(GContextWindows));
	gc->color = RGB(0, 0, 0);
	gc->hdc = NULL;
	return gc;
}

void gContext_setDC(GContext context, HDC dc)
{
	GContextWindows wc = (GContextWindows)context;
	wc->hdc = dc;
}

void draw_rectangle(GContext context, int x1, int y1, int x2, int y2)
{
	GContextWindows wc = (GContextWindows)context;
	Rectangle(wc->hdc, x1, y1, x2, y2);
}

void draw_line(GContext context, int x1, int y1, int x2, int y2)
{
	GContextWindows wc = (GContextWindows)context;
	MoveToEx(wc->hdc, x1, y1, NULL);
	LineTo(wc->hdc, x2, y2);
}

void draw_setColor(GContext context, int r, int g, int b)
{
	GContextWindows wc = (GContextWindows)context;
	wc->color = RGB(r,g,b);
}


